package com.cogent.business.util;

import java.util.HashMap;

import com.cogent.common.util.MapUtil;
import com.cogent.dao.facade.BussinessDaoFacade;

public class MobileMessageUtil {
	
	public static void sendBusMessage(BussinessDaoFacade bussinessFacade, HashMap msgMap) {
		msgMap.put("type", "0");
		msgMap.put("trytime", "0");
		if(MapUtil.isEmpty(msgMap, "issend"))
			msgMap.put("issend", "1");
		String temp = MapUtil.getStringValue(msgMap, "message");
		while(true) {
			if(temp.length() == 0)
				break;
			String message = temp;
			if(temp.length() > 300) {
				message = temp.substring(0, 300);
				temp = temp.substring(300);
			}else
				temp = "";
			msgMap.remove("id");
			msgMap.put("message", message);
			bussinessFacade.save("mb_message", msgMap);
		}
	}
}
